<?php

namespace App\Admin\Controllers;

use App\Library\Logic\OperateLogLogic;
use App\Library\Logic\ShopCategoryLogic;
use App\Library\Traits\AdminControllerTrait;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Form;

class ShopProductAnimalController extends ShopProductController
{
    public function form(): Form
    {
        $form = $this->hiddenForm();
        $form->hidden('product_category_id_1')->default(59);
        $item = $this->item($form);
        $two = ShopCategoryLogic::getByParentId($item->product_category_id_1 ?? 59);
        $three = ShopCategoryLogic::getByParentId($item->product_category_id_2 ?? 70);
        $this->leftColumn($form, $item, $two);
        $this->rightColumn($form, $item, $three);
        $this->specColumn($form, $item);
        $this->savingForm($form);
        $this->savedForm($form);
        $form->confirm('确定提交吗?');
        OperateLogLogic::add(Admin::user()->user_id);
        Admin::js('js/plug.js');
        return $form;
    }
}
